@extends('home.seller.layout.index')

@section('content')
	<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span>
            <i class="icon-table">
            </i>
            订单列表
        </span>
    </div>
    <div class="mws-panel-body no-padding">
        <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
            <form action="/home/seller/order/index" method="get">
            	{{ csrf_field() }}
                <div id="DataTables_Table_0_length" class="dataTables_length">
                    <label>
                        显示
                        <select size="1" name="count" aria-controls="DataTables_Table_0">
                            <option value="10" @if(!empty($request['count']) && $request['count'] == 10 ) selected @endif>
                                10
                            </option>
                            <option value="15" @if(!empty($request['count']) && $request['count'] == 15 ) selected @endif>
                                15
                            </option>
                            <option value="20" @if(!empty($request['count']) && $request['count'] == 20 ) selected @endif>
                                20
                            </option>
                            <option value="25" @if(!empty($request['count']) && $request['count'] == 25 ) selected @endif>
                                25
                            </option>
                        </select>
                        条
                    </label>
                </div>
                <div class="dataTables_filter" id="DataTables_Table_0_filter">
                    <label>
                        关键字:
                        <input type="text" aria-controls="DataTables_Table_0" name="search" value="{{ $request['search'] or '' }}" placeholder="商品名称">
                    </label>
                    <button type="submit" class="btn btn-default"> 搜索 </button>
                </div>
            </form>
            <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1"
            aria-describedby="DataTables_Table_1_info">
                <thead>
                    <tr role="row">
                        <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending"
                        style="width: 156px;">
                            商品名
                        </th>
                        <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending"
                        style="width: 80px;">
                            数量
                        </th>
                        <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending"
                        style="width: 120px;">
                            提交时间
                        </th>
                        <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending"
                        style="width: 136px;">
                            提交人
                        </th>
                         <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending"
                        style="width: 160px;">
                           收件人详细信息
                        </th>
                         <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending"
                        style="width: 101px;">
                           订单状态
                        </th>
                         <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1"
                        rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending"
                        style="width: 70px;">
                           操作
                        </th>
                    </tr>
                </thead>
                <tbody role="alert" aria-live="polite" aria-relevant="all">
                	@foreach($data as $k=>$v)
                    <tr class="odd">
                        <td class=" sorting_1">
                            <img src="{{ $v['picture'] }}" alt="加载失败" style="width:80px">　{{ $v['goodsname'] }}
                        </td>
                        <td class="" style="text-align:center">
                            {{ $v['num'] }}
                        </td>
                        <td class=" "  style="text-align:center">
                           	{{ date('Y-m-d H:i:s',$v['ctime']) }}
                        </td>
                        <td class=" "  style="text-align:center">
                            {{ $v['subuser'] }}
                        </td>
                        <td class=" ">
                            收件人：{{ $v['sitename'] }}<br>收件地址：{{ $v['site'] }}<br>电话：{{ $v['sitephone'] }}
                        </td>
                        <td class=" "  style="text-align:center">
                            @if($v['merstatus'] == 0)
                            <span style="color:#00B2EE">交易完成</span>
                            @elseif($v['merstatus'] == 1)
                            <span style="color:#228B22">已发货</span>
                            @elseif($v['merstatus'] == 2)
                            <span style="color:#FF7F24">未处理</span>
                            @elseif($v['merstatus'] == 3)
                            <span style="color:#EE6464">退款处理中</span>
                            @elseif($v['merstatus'] == 4)
                            <span style="color:#A020EF">退款未处理</span>
                            @endif
                        </td>
                        <td class=" " style="text-align:center">
                        @if($v['merstatus'] == 2)
                            <a href="/home/seller/order/manage?id={{ $v['id'] }}&merstatus=1" style="color:#0000CD" title="接受订单" onclick="return confirm('你确认发货吗？')"><i class="icon-truck" style="font-size:25px"></i></a>
                        @elseif($v['merstatus'] == 4)    
                            <a href="/home/seller/order/manage?id={{ $v['id'] }}&merstatus=3&price={{ $v['price'] }}" style="color:#0000CD" title="同意退款" onclick="return confirm('你确认同意退款吗？')"><i class="icon-bended-arrow-left" style="font-size:25px"></i></a>
                        @endif
                            　<a href="/home/seller/order/odetail?id={{ $v['id'] }}" style="color:#0000CD" title="订单日志"><i class="icon-align-justify" style="font-size:25px"></i></a>
                    	</td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
            <div class="dataTables_info" id="DataTables_Table_1_info">
                共{{ $num }}条
            </div>
            <div id="page_page">
                {!! $res -> appends($request) -> render() !!}
            </div>
        </div>
    </div>
</div>
@endsection